
package com.jf.cloud.search.constant;

import org.elasticsearch.search.sort.SortOrder;


/**
 * 商品排序
 * @author zz
 * @date 2020/11/17
 */
public enum EsProductSortEnum {

    /**
     * 创建时间正序
     */
    CREATE_TIME_ASC(0, "createTime", SortOrder.ASC),

    /**
     * 创建时间倒序
     */
    CREATE_TIME_DESC(1, "createTime", SortOrder.DESC),

    /**
     * 销量倒序
     */
    SALE_NUM_DESC(2, "saleNum", SortOrder.DESC),

    /**
     * 销量正序
     */
    SALE_NUM_ASC(3, "saleNum", SortOrder.ASC),

    /**
     * 商品价格倒序
     */
    PRICE_DESC(4, "priceFee", SortOrder.DESC),

    /**
     * 商品价格正序
     */
    PRICE_ASC(5, "priceFee", SortOrder.ASC),

    /**
     * 分组排序
     */
    SPU_TAG_DESC(6, "tags.seq", SortOrder.DESC),

    /**
     * 市场价倒序
     */
    MARKET_PRICE_DESC(7, "marketPriceFee", SortOrder.DESC),

    /**
     * 市场价正序
     */
    MARKET_PRICE_ASC(8, "marketPriceFee", SortOrder.ASC),

    /**
     * 分组正序
     */
    SPU_TAG_ASC(9, "tags.seq", SortOrder.ASC),

    /**
     * 商品库存倒序
     */
    STOCK_DESC(10, "stock", SortOrder.DESC),

    /**
     * 商品库存正序
     */
    STOCK_ASC(11, "stock", SortOrder.ASC),

    /**
     * 商品序号倒序
     */
    SEQ_DESC(12, "seq", SortOrder.DESC),

    /**
     * 商品序号正序
     */
    SEQ_ASC(13, "seq", SortOrder.ASC),

    /**
     * 评论数量倒序
     */
    COMMENT_NUM_DESC(14, "commentNum", SortOrder.DESC),

    /**
     * 评论数量正序
     */
    COMMENT_NUM_ASC(15, "commentNum", SortOrder.ASC),

    /**
     * 根据置顶状态排序
     */
    IS_TOP_DESC(16, "isTop", SortOrder.DESC),

    /**
     * 实际销量倒序
     */
    ACTUAL_SOLD_NUM_DESC(17, "actualSoldNum", SortOrder.DESC),

    /**
     * 实际销量正序
     */
    ACTUAL_SOLD_NUM_ASC(18, "actualSoldNum", SortOrder.ASC),

    /**
     * 注水销量倒序
     */
    WATER_SOLD_NUM_DESC(19, "waterSoldNum", SortOrder.DESC),

    /**
     * 注水销量正序
     */
    WATER_SOLD_NUM_ASC(20, "waterSoldNum", SortOrder.ASC),

    /**
     * spu编码正序
     */
    SPU_CODE_ASC(21, "spuCode", SortOrder.ASC),

    /**
     * spu编码倒序
     */
    SPU_CODE_DESC(22, "spuCode", SortOrder.DESC),

    /**
     * spu状态正序
     */
    SPU_STATUS_ASC(23, "spuStatus", SortOrder.ASC),

    /**
     * spu状态倒序
     */
    SPU_STATUS_DESC(24, "spuStatus", SortOrder.DESC),


    ;

    private final Integer value;

    private final String param;

    private final SortOrder order;

    public Integer value() {
        return value;
    }

    EsProductSortEnum(Integer value, String param, SortOrder order) {
        this.value = value;
        this.param = param;
        this.order = order;
    }

    public String param() {
        return param;
    }

    public SortOrder order() {
        return order;
    }


//    public static Boolean isAsc(EsProductSortEnum esProductSortEnum) {
//        if (Objects.equals(esProductSortEnum.order(), Boolean.TRUE)) {
//            return Boolean.TRUE;
//        }
//        return Boolean.FALSE;
//    }
//    public static Boolean isDesc(EsProductSortEnum esProductSortEnum) {
//        if (Objects.equals(esProductSortEnum.order(), Boolean.FALSE)) {
//            return Boolean.TRUE;
//        }
//        return Boolean.FALSE;
//    }
}
